package com.changanw.ratelimiter.controller;

import com.changanw.ratelimiter.annotation.RateLimiter;
import com.changanw.ratelimiter.enums.LimitType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class HelloController {
    /**
     * 限流10s内访问三次
     * @return
     */
    @GetMapping("/hello")
    @RateLimiter(time = 10,count = 3,limitType = LimitType.IP)
    public String hello(){
        return "hello";
    }
}
